-- lvim.lsp.automatic_servers_installation = false

vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "clangd" })

-- local formatters = require "lvim.lsp.null-ls.formatters"
-- formatters.setup{ {name = "black"} }

-- local linter = require "lvim.lsp.null-ls.linters"
-- linter.setup{ {command = "flake8", args = {"--ignore=E203"}, filetype = {"python"}} }

-- 用pylsp代替pyright
vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" })
-- remove `jedi_language_server` from `skipped_servers` list
lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server)
  return server ~= "pylsp"
end, lvim.lsp.automatic_configuration.skipped_servers)

local clangd = {
  flags = {
    "--fallback-style=google",
    "--background-index",
    "-j=12",
    "--all-scopes-completion",
    "--pch-storage=disk",
    "--clang-tidy",
    "--log=error",
    "--completion-style=detailed",
    "--header-insertion=iwyu",
    "--header-insertion-decorators",
    "--enable-config",
    "--offset-encoding=utf-16",
    "--ranking-model=heuristics",
    "--folding-ranges",
  },
  bin = "clangd",
}
clangd.opts = {
  cmd = { clangd.bin, unpack(clangd.flags) },
}

local lsp_manager_setup = require("lvim.lsp.manager").setup
lsp_manager_setup("clangd", clangd.opts)
